#CC=g++ -Wall -pg -g
CC=g++ -Wall -g -D DEBUG
#CC=g++ -Wall -g
CCND=g++ -Wall -g
#CCND=g++ -Wall -g -pg
CFLAGS=-O3 -funroll-loops -c
LDFLAGS=-O2 -lm
OBJSOURCES=Square.cc State.cc MapKnowledge.cc Bot.cc munkres.cc Planif.cc Order.cc Strategy.cc
EXESOURCES=MyBot.cc
SOURCES=$(OBJSOURCES) $(EXESOURCES)
HEADERS=Bug.h Map.hh munkres.h matrix.h Square.hh State.h MapKnowledge.hh Timer.h Torus.hh
SUBMIT=Makefile ${SOURCES} ${HEADERS}
OBJECTS=$(OBJSOURCES:.cc=.o)
XOBJECTS=$(EXESOURCES:.cc=.o)
EXECUTABLE=MyBot

#Uncomment the following to enable debugging
#CFLAGS+=-g -DDEBUG

all: $(OBJECTS) $(XOBJECTS) munkres.o $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS) $(XOBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) $(XOBJECTS) -o $@

# no DEBUG mode for munkres
munkres.o: munkres.cc
	$(CCND) $(CFLAGS) $< -o $@	

.cc.o:
	$(CC) $(CFLAGS) $< -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@


%: %.cc $(OBJECTS)
	$(CC) $(LDLAGS) $< -o $@

clean: 
	-rm -f ${EXECUTABLE} ${OBJECTS} *.d
	-rm -f debug.txt
	-rm -f *.o
	-rm -f *~
	-rm -f debug_*.txt
	-rm -f turn*.dat



zip: clean
	-rm -f *.zip
	zip search_and_destroy.zip *



.PHONY: all clean zip


